<?php

namespace App\Http\Controllers\Classify;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\Commodity_classify;

/**
 * Class ClassifyController
 * @package App\Http\Controllers\Classify
 * @User wuqin
 * @Date 2018/4/13 0013
 * @Time 11:36
 */
class ClassifyController extends Controller
{
    //
    /**
     * 方法 : index
     * @User wuqin
     * @DateTime 2018-04-13 11:36
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        $user = session('user_info');
        if (empty($user))
            return $this->error_url('/', '请重新登录', 3);
        $classify  = new Commodity_classify;
        return view('Classify.index', ['user' => $user,'classify' => $classify->get_classify()]);
    }

    /**
     * 方法 : classify
     * @User wuqin
     * @DateTime 2018-04-13 11:36
     * @param Request $request
     * @param $classifyId
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function classify(Request $request, $classifyId)
    {
        $user = session('user_info');
        if (empty($user))
            return $this->error_url('/', '请重新登录', 3);
        $classify = new Commodity_classify;
        return view('Classify.index', ['user' => $user, "select" => $classifyId, 'classify' => $classify->get_classify()]);
    }
}
